import datetime
import multiprocessing
from util import *
import copy
from CloudSystem import run_once



def generate_default_args():
    args=Args()
    args.deploy_schedule_strategy = "ours"
    args.bare_metal_node_num=10
    args.state_resource_percent=0.5
    args.until_time=0
    args.print_level=0
    args.request_num=1000
    args.trace_id=1
    args.time_expand=1
    
    return args


def run_once_this(method):
    print(f"start once {method}")
    args=generate_default_args()
    args.deploy_schedule_strategy=method
    args_copy=copy.deepcopy(args)
    run_once(args_copy)
    print(f"End once {method}")
    
    



task_args_list=[]


for method in ["ours", "RR","R_RIR", "C_GM", "QFEC", "GSMS"]:#
    task_args_list.append((method,))
        
                

with multiprocessing.Pool(processes=32) as pool:
        # 使用 starmap 方法将任务分配给进程池中的进程执行
        pool.starmap(run_once_this, task_args_list)


    
print("End all sub threadings")
